<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/jsp/component/common.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <title>体质修改</title>
    <meta charset="utf-8">
    <!-- Bootstrap Core CSS -->
    <link href="${css}/bootstrap.min.css" rel="stylesheet"/>
    <!-- bootstrapValidator验证 -->
    <link href="${assets}/bootstrapValidator/css/bootstrapValidator.css" rel="stylesheet"/>
</head>
<body style="width: 98%">
<form id="myForm" class="form-horizontal" method="post" >
    <input type="hidden" name="id" value="${corporeity.id}" />
    <div class="form-group">
        <label for="itemName" class="col-sm-2 control-label">名称</label>
        <div class="col-sm-10">
            <input type="text" class="form-control" id="itemName" name="itemName" value="${corporeity.itemName}"
                   placeholder="请输入名称">
        </div>
    </div>
    <div class="form-group">
        <label for="dietGuid" class="col-sm-2 control-label">饮食建议</label>
        <div class="col-sm-10">
            <textarea class="form-control" id="dietGuid" name="dietGuid" rows="5" placeholder="请输入饮食建议">${corporeity.dietGuid}</textarea>
        </div>
    </div>
    <div class="form-group">
        <label for="feature" class="col-sm-2 control-label">特征</label>
        <div class="col-sm-10">
            <textarea class="form-control" id="feature" name="feature" rows="5" placeholder="请输入特征">${corporeity.feature}</textarea>
        </div>
    </div>
    <div class="form-group">
        <label for="incidenceTendency" class="col-sm-2 control-label">发病倾向</label>
        <div class="col-sm-10">
            <textarea class="form-control" id="incidenceTendency" name="incidenceTendency" rows="5" placeholder="请输入发病倾向">${corporeity.incidenceTendency}</textarea>
        </div>
    </div>
    <div class="form-group">
        <label for="healthcareGuid" class="col-sm-2 control-label">保健</label>
        <div class="col-sm-10">
            <textarea class="form-control" id="healthcareGuid" name="healthcareGuid" rows="5" placeholder="请输入保健">${corporeity.healthcareGuid}</textarea>
        </div>
    </div>
    <div class="modal-footer" style="text-align: center ">
        <button type="button" class="btn btn-default" data-dismiss="modal" id="closeModalButt">关闭</button>
        <button type="submit" class="btn btn-primary">保存</button>
    </div>
</form>

<!-- jQuery -->
<script src="${js}/jquery-1.9.1.min.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="${js}/bootstrap.min.js"></script>

<script src="${js}/bootbox.js"></script>
<!-- bootstrapValidator验证 -->
<script src="${assets}/bootstrapValidator/js/bootstrapValidator.js"></script>
<!-- bootstrapValidator验证 国际化中文 -->
<script src="${assets}/bootstrapValidator/js/language/zh_CN.js"></script>

<script type="text/javascript">
    $(document).ready(function() {
        $('#myForm').bootstrapValidator({
            message: 'This value is not valid',
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                itemName: {
                    validators: {
                        notEmpty: true
                    }
                }
            }
        }).on('success.form.bv', function (e) {
            e.preventDefault();
            $.ajax({
                url:'${URL_ADM_CORPOREITY_UPDATE}',
                type:'post',
                data:$('#myForm').serialize(),
                async : false, //默认为true 异步
                error:function(){
                    alert('error');
                },
                success:function(data){
                    window.parent.closeModal("update");
                }
            });
        });

        $("#closeModalButt").on("click",function(){
            window.parent.simpleCloseModal("update");
        });

    });

    <%--function doUpdate(){--%>
        <%--$.ajax({--%>
            <%--url:'${URL_ADM_CORPOREITY_UPDATE}',--%>
            <%--type:'post',--%>
            <%--data:$('#myForm').serialize(),--%>
            <%--async : false, //默认为true 异步--%>
            <%--error:function(){--%>
                <%--alert('error');--%>
            <%--},--%>
            <%--success:function(data){--%>
                <%--window.parent.closeModal("update");--%>
            <%--}--%>
        <%--});--%>
    <%--}--%>

</script>
</body>
</html>